//
//  DerbyStopwatch.h
//  DerbyOSSampler
//
//  Created by glenn andreas on 3/6/14.
//  Copyright (c) 2014 glenn andreas. All rights reserved.
//

#import <Foundation/Foundation.h>

/*
 A general purpose stop-watch like timer.  Timers start at 0:00.
 Start: Reset timer, starts
 Stop: Stops timer, holds time
 Resume: Resumes the timer, continue with time
 ResetTimer: Sets time back to 0:00, does not alter running status.
 "ellapsedTime" is observable
*/
@interface DerbyStopwatch : NSObject
@property (readonly, nonatomic) NSTimeInterval ellapsedTime;
@property (readonly, nonatomic) NSTimeInterval timeLeft;
@property (assign, nonatomic) BOOL countsUp;
@property (assign, nonatomic) NSTimeInterval maximumTime;
- (id) initWithMaximumTime: (NSTimeInterval) maximumTime;
- (id) initWithMaximumTime: (NSTimeInterval) maximumTime countsUp: (BOOL) countsUp;
- (void) start;
- (void) start: (NSTimeInterval) time;
- (void) stop;
- (void) resume;
- (void) reset;
- (void) reset: (NSTimeInterval) time;
@property (readonly, nonatomic) BOOL isRunning;
@property (readonly, nonatomic) NSString *timeString; // formatted based on max & direction - also observerable
+ (NSString *) formatTime: (NSInteger) time; // [h:m]m:ss
@end
